export enum AlarmTypeEnum {
  Concentration = '01', // 浓度报警
  Pressure = '02', // 压力报警
  Flow = '03', // 流量报警
  Valve = '04', //阀门状态报警
  Break = '05' //破坏报警
}

export const getAlarmTypeCode = (name: string): AlarmTypeEnum => {
  switch (name) {
    case '阀门状态报警':
      return AlarmTypeEnum.Valve;
    case '破坏报警':
      return AlarmTypeEnum.Break;
    case '流量报警':
      return AlarmTypeEnum.Flow;
    case '压力报警':
      return AlarmTypeEnum.Pressure;
    case '浓度报警':
    default:
      return AlarmTypeEnum.Concentration;
  }
};

export const getAlarmTypeName = (code: string): string => {
  switch (code) {
    case AlarmTypeEnum.Valve:
      return '阀门状态报警';
    case AlarmTypeEnum.Break:
      return '破坏报警';
    case AlarmTypeEnum.Flow:
      return '流量报警';
    case AlarmTypeEnum.Pressure:
      return '压力报警';
    case AlarmTypeEnum.Concentration:
    default:
      return '浓度报警';
  }
};
